import config
import random
import map
import time
import account

last_time_dict = {}

def ramdom_move(player):
    player_map = map.get_data(player)
    global last_random_move_time
    random_move_space = 5
    now_time = round(time.time())
    player_account = account.get_data(player)
    last_time = last_time_dict.get(player_account.uid, 0)
    if player_account.uid == 10000 and player_map.x >=0 and player_map.y >=0 and now_time - last_time >= random_move_space:
        last_time_dict[player_account.uid] = now_time
        randx = random.randint(0, config.get_screen_x())
        randy = random.randint(0, config.get_screen_y())
        map.tos_sync_map(player, randx, randy)


def ramdom_enter(player):
    randx = random.randint(0, config.get_screen_x())
    randy = random.randint(0, config.get_screen_y())
    map.tos_enter_map(player, randx, randy) 


